//
//  PurchaseViewController.m
//  tuanGG
//
//  Created by 李洪旭 on 15/11/19.
//  Copyright (c) 2015年 weita. All rights reserved.
//

#import "PurchaseViewController.h"
#import "ValidTermViewController.h"
#import "ScopeOfApplicationViewController.h"
#import "UseTimeViewController.h"
#import "UseRulesViewController.h"
@interface PurchaseViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong)NSArray *dataArray;
@end

@implementation PurchaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithHexString:@"f0efed"];
    [self addnavigationTitle:@"购买须知" navColor:@"4fd2be"];
    [self addTableView];
    [self initlizeDataSource];
}
- (void)initlizeDataSource {
    _dataArray = @[@"适用范围",@"有效期限",@"使用时间",@"使用规则"];
}
- (void)addTableView {
    UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 180)];
    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.tableFooterView = [[UITableView alloc]init];
    tableView.scrollEnabled = NO;
    [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"CELL"];
    [self.view addSubview:tableView];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 45;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CELL"];
    cell.textLabel.text = _dataArray[indexPath.row];
    cell.textLabel.font = [UIFont systemFontOfSize:13];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        ScopeOfApplicationViewController *scopeVC = [[ScopeOfApplicationViewController alloc]init];
        [self.navigationController pushViewController:scopeVC animated:YES];
    }else if (indexPath.row == 1) {
        ValidTermViewController *ValidTerm = [[ValidTermViewController alloc]init];
        [self.navigationController pushViewController:ValidTerm animated:YES];
    }else if (indexPath.row == 2) {
        UseTimeViewController *useTime =[[UseTimeViewController alloc]init];
        [self.navigationController pushViewController:useTime animated:YES];
    }else if (indexPath.row == 3) {
        UseRulesViewController *UseRules =[[UseRulesViewController alloc]init];
        [self.navigationController pushViewController:UseRules animated:YES];
    }
}
@end
